﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IFRS.Web;
using IFRS.DataAccess.DAL;
using IFRS.Models;
using System.Data;
using IFRS_Global;
using System.Threading;
using System.Globalization;

public partial class IFRS_WIN19_3V : PageBase
{
     #region "---------- Events -----------"
    protected void Page_Load(object sender, EventArgs e)
    {
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
        if (!(Page.IsPostBack || Page.IsCallback))
        {
            this.ViewMenu();
            this.BindDDL();
            this.BindData(Convert.ToInt32(Request.QueryString["id"].ToString()));
            SetControl();
        }
        else
            ClientScript.RegisterHiddenField("isPostBack", "1");
    }

    protected void btnCANCEL_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/IFRS/WIN19_1S.aspx");
    }

    #endregion
    #region "----- Methods -------"
    private void ViewMenu()
    {
        this.MenuTitleBar = Resources.ifrsMenu.WIN19_3V;
    }
    private void SetControl()
    {
        SetControlReadOnly(form_control);
    }
    private void BindDDL()
    {
        ddlSource_data.SetData(DDL_TYPE.SourceData, "", true, false);
    }
    private void BindData(int ID)
    {
        var vREIR = new SPR_EIR();
        DataTable dtvREIR = vREIR.SEARCH_BYID(ID);
        List<EIR> EIR = new List<EIR>();
        ConvertHelper.ConvertDataTableToObject(dtvREIR, EIR);

        if (dtvREIR.Rows.Count > 0)
        {
            hidEIRID.Value = EIR[0].EIRID.ToString();
            txtAccountNo.Text = EIR[0].AccountNo;
            txtTransactionDate.Text = EIR[0].TransactionDate.DateToString();
            txtEIRValue.Text = EIR[0].EIRValue.ToString();
            ddlSource_data.SelectedValue = EIR[0].SourceDataID.ToString();

        }
    }

    #endregion
}